data.cor <- cor(county.Demo_and_Covid.allcounties[,-1], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
data.cor2 <- cor(county.Demo_and_Covid.500counties[,-c(1:2)], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor2, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
corrplot.mixed(data.cor2[7:13,c(1:5, 14:42,6)], upper = 'ellipse', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)", data = county.Demo_and_Covid.500counties)
## Warning: Some predictor variables are on very different scales: consider
## rescaling
## Warning: Some predictor variables are on very different scales: consider
## rescaling
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -1255.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.3241 -0.3636 -0.0844 0.1898 6.1906
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.000002398 0.001548
## Residual 0.000013818 0.003717
## Number of obs: 186, groups: stateID, 34
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -0.0154731942 0.0099584384 82.8034083521
## Affluence 0.0045341127 0.0011252942 120.5433150752
## Singletons.in.Tract 0.0005232057 0.0009261387 159.2482772393
## Seniors.in.Tract 0.0001247819 0.0012020155 164.0158565360
## African.Americans.in.Tract 0.0012085107 0.0010285119 163.2407323254
## Noncitizens.in.Tract 0.0011358376 0.0007739776 130.5342057444
## High.BP 0.0001371935 0.0001925901 129.3324403743
## Binge.Drinking 0.0002447916 0.0001682112 54.2811644767
## Cancer -0.0013227465 0.0011385277 125.1044038400
## Asthma 0.0009927878 0.0005842391 58.0525802712
## Heart.Disease 0.0022395352 0.0013836000 94.2968173029
## COPD -0.0006063137 0.0011398142 90.1085367999
## Smoking -0.0000332818 0.0002375475 97.8676487264
## Diabetes -0.0006904588 0.0005577040 94.8483913464
## No.Physical.Activity -0.0000197431 0.0002156239 108.3215669324
## Obesity 0.0002919261 0.0001816818 131.5096677261
## Poor.Sleeping.Habits -0.0000507855 0.0001675732 141.2214405664
## Poor.Mental.Health -0.0000807278 0.0004592101 38.9567616314
## Testing_Rate 0.0000006361 0.0000002439 43.9976833191
## Hospitalization_Rate -0.0000657794 0.0000942816 32.4273079601
## t value Pr(>|t|)
## (Intercept) -1.554 0.1241
## Affluence 4.029 0.0000983 ***
## Singletons.in.Tract 0.565 0.5729
## Seniors.in.Tract 0.104 0.9174
## African.Americans.in.Tract 1.175 0.2417
## Noncitizens.in.Tract 1.468 0.1446
## High.BP 0.712 0.4775
## Binge.Drinking 1.455 0.1514
## Cancer -1.162 0.2475
## Asthma 1.699 0.0946 .
## Heart.Disease 1.619 0.1089
## COPD -0.532 0.5961
## Smoking -0.140 0.8889
## Diabetes -1.238 0.2188
## No.Physical.Activity -0.092 0.9272
## Obesity 1.607 0.1105
## Poor.Sleeping.Habits -0.303 0.7623
## Poor.Mental.Health -0.176 0.8614
## Testing_Rate 2.608 0.0124 *
## Hospitalization_Rate -0.698 0.4903
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence 0.079
## Sngltns.n.T 0.009 0.044
## Snrs.n.Trct 0.522 0.365 0.174
## Afrcn.Am..T 0.146 0.155 -0.407 0.144
## Nnctzns.n.T 0.037 0.101 0.071 0.092 -0.110
## High.BP -0.053 0.211 0.047 0.070 -0.097 0.386
## Bing.Drnkng -0.326 -0.167 -0.284 -0.163 0.058 -0.004 0.125
## Cancer -0.569 -0.162 0.198 -0.289 -0.072 -0.148 -0.346 -0.093
## Asthma -0.382 -0.196 -0.240 -0.203 0.083 0.050 0.164 -0.002 0.049
## Heart.Dises -0.148 0.089 -0.300 -0.146 0.258 -0.123 0.007 0.061 -0.492
## COPD 0.569 0.001 0.155 0.260 -0.036 0.290 0.135 0.077 -0.262
## Smoking -0.135 0.171 -0.186 -0.093 -0.032 0.043 -0.052 -0.289 0.074
## Diabetes 0.101 -0.333 -0.102 -0.210 -0.302 -0.284 -0.532 0.054 0.244
## N.Physcl.Ac -0.207 -0.011 0.094 -0.016 -0.033 -0.230 -0.069 0.116 0.480
## Obesity 0.010 0.410 0.438 0.305 0.128 0.175 -0.098 -0.230 0.093
## Pr.Slpng.Hb -0.426 -0.403 0.148 -0.335 -0.329 -0.026 -0.177 0.115 0.117
## Pr.Mntl.Hlt -0.354 0.271 -0.070 -0.044 0.090 -0.189 -0.050 0.083 0.326
## Testing_Rat 0.221 -0.046 0.003 0.037 0.028 -0.004 -0.013 -0.027 -0.216
## Hsptlztn_Rt -0.129 -0.197 -0.077 -0.206 -0.044 -0.107 -0.049 -0.096 -0.003
## Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A Obesty Pr.S.H Pr.M.H
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises 0.275
## COPD -0.383 -0.562
## Smoking 0.089 0.203 -0.495
## Diabetes -0.114 -0.315 -0.066 0.217
## N.Physcl.Ac 0.028 -0.384 -0.009 -0.330 -0.098
## Obesity -0.270 -0.080 0.153 -0.195 -0.378 -0.045
## Pr.Slpng.Hb 0.079 0.235 -0.161 -0.069 -0.025 -0.114 -0.166
## Pr.Mntl.Hlt -0.252 0.091 -0.468 0.084 0.022 0.050 0.059 -0.166
## Testing_Rat -0.322 -0.018 0.214 0.136 0.084 -0.315 0.139 -0.145 -0.135
## Hsptlztn_Rt 0.094 0.120 -0.115 0.050 0.006 -0.010 -0.019 -0.003 -0.078
## Tstn_R
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises
## COPD
## Smoking
## Diabetes
## N.Physcl.Ac
## Obesity
## Pr.Slpng.Hb
## Pr.Mntl.Hlt
## Testing_Rat
## Hsptlztn_Rt 0.069
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)", data = county.Demo_and_Covid.500counties)
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -2433.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.8005 -0.3835 -0.0820 0.2778 6.5610
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.000007847 0.002801
## Residual 0.000013007 0.003607
## Number of obs: 326, groups: stateID, 51
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) -0.02374881 0.00810336 193.06864902 -2.931
## Affluence 0.00303784 0.00073564 302.35759457 4.129
## Singletons.in.Tract 0.00076577 0.00068685 301.02751482 1.115
## Seniors.in.Tract 0.00036507 0.00086755 304.52067557 0.421
## African.Americans.in.Tract 0.00185376 0.00083859 306.80282282 2.211
## Noncitizens.in.Tract 0.00188332 0.00067656 271.90377206 2.784
## High.BP -0.00002254 0.00015180 298.84359504 -0.148
## Binge.Drinking 0.00040978 0.00015953 159.47547855 2.569
## Cancer -0.00033713 0.00089039 266.60789774 -0.379
## Asthma 0.00080796 0.00052879 141.79554831 1.528
## Heart.Disease 0.00319402 0.00114238 211.40118532 2.796
## COPD -0.00135854 0.00086479 205.85372606 -1.571
## Smoking -0.00019193 0.00019990 251.34232895 -0.960
## Diabetes -0.00115859 0.00042840 269.31987743 -2.704
## No.Physical.Activity 0.00031822 0.00017208 238.01560139 1.849
## Obesity 0.00025223 0.00013934 307.96509372 1.810
## Poor.Sleeping.Habits 0.00024295 0.00013416 297.33747351 1.811
## Poor.Mental.Health -0.00015970 0.00044866 103.72419434 -0.356
## Pr(>|t|)
## (Intercept) 0.00379 **
## Affluence 0.0000471 ***
## Singletons.in.Tract 0.26578
## Seniors.in.Tract 0.67419
## African.Americans.in.Tract 0.02780 *
## Noncitizens.in.Tract 0.00575 **
## High.BP 0.88205
## Binge.Drinking 0.01113 *
## Cancer 0.70527
## Asthma 0.12876
## Heart.Disease 0.00565 **
## COPD 0.11773
## Smoking 0.33790
## Diabetes 0.00728 **
## No.Physical.Activity 0.06565 .
## Obesity 0.07124 .
## Poor.Sleeping.Habits 0.07117 .
## Poor.Mental.Health 0.72260
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence -0.050
## Sngltns.n.T -0.055 0.043
## Snrs.n.Trct 0.395 0.293 0.073
## Afrcn.Am..T 0.241 0.076 -0.405 0.202
## Nnctzns.n.T -0.072 0.153 0.125 0.057 -0.190
## High.BP -0.095 0.157 0.099 0.007 -0.233 0.327
## Bing.Drnkng -0.488 -0.040 -0.205 -0.068 0.042 -0.076 0.148
## Cancer -0.495 -0.095 0.231 -0.172 -0.074 -0.066 -0.329 -0.019
## Asthma -0.269 -0.096 -0.262 -0.121 -0.014 0.211 0.052 0.008 -0.157
## Heart.Dises -0.058 0.077 -0.301 -0.132 0.213 -0.054 0.000 0.034 -0.602
## COPD 0.479 0.009 0.128 0.172 -0.006 0.156 0.058 0.059 -0.212
## Smoking -0.043 0.105 -0.119 -0.137 -0.105 0.159 -0.082 -0.327 0.157
## Diabetes 0.036 -0.301 -0.078 -0.133 -0.230 -0.253 -0.446 0.075 0.367
## N.Physcl.Ac -0.116 0.034 0.101 0.079 0.059 -0.274 0.004 0.126 0.336
## Obesity -0.066 0.383 0.398 0.202 0.133 0.193 -0.103 -0.147 0.118
## Pr.Slpng.Hb -0.385 -0.351 0.162 -0.326 -0.321 -0.046 -0.156 0.087 0.028
## Pr.Mntl.Hlt -0.354 0.183 -0.008 0.022 0.051 -0.165 0.028 0.130 0.417
## Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A Obesty Pr.S.H
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises 0.336
## COPD -0.322 -0.491
## Smoking 0.144 0.083 -0.475
## Diabetes -0.106 -0.433 -0.008 0.278
## N.Physcl.Ac -0.022 -0.360 0.087 -0.274 -0.169
## Obesity -0.126 -0.021 0.091 -0.220 -0.376 -0.045
## Pr.Slpng.Hb 0.000 0.239 -0.092 -0.168 -0.060 -0.153 -0.115
## Pr.Mntl.Hlt -0.437 -0.066 -0.389 -0.028 0.071 -0.086 0.025 -0.081
testing.data.state <- compiled.stats[[length(daily_filenames)]][, c("Province_State", "Testing_Rate")]
testing.data.state <- testing.data.state[!is.na(testing.data.state$Testing_Rate),]
testing.data.state <- testing.data.state[order(testing.data.state$Testing_Rate),]
col.state <- rep("pink", nrow(testing.data.state))
avg.test.rate <- mean(testing.data.state$Testing_Rate, na.rm = T)
col.state[testing.data.state$Testing_Rate < avg.test.rate] <- "grey"
col.state[testing.data.state$Province_State == "Oklahoma"] <- "lightblue"
par(mar = c(5,6,4,2))
barplot(testing.data.state$Testing_Rate, names.arg = testing.data.state$Province_State, horiz = T, main = "Testing Rate by State", las = 2, cex.axis = 1, cex.names = 0.5, col = col.state, border = F, xlab = "Total number of people tested per 100,000 persons.")
abline(v = avg.test.rate, col = "red")
text(x = avg.test.rate + 10, y = 1, labels = "Average Testing Rate", adj = c(0, 0.5), col = "red")
Pink highlights the last 14 days.
day.first.case <- min(which(US.total$cases.total > 100))
n.days <- nrow(US.total)
twoweek.col <- c(rep("grey", n.days-day.first.case-13), rep("pink", 14))
par(mar = c(5,5,4,2))
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$rise.cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Cases of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$rise.deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Deaths of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)